#!/bin/sh

dbHost="192.168.1.243"
dbUser="work"
dbPass="xjydxT:7Udxp8cf"
dbName="kline"

rebuildDbStructs()
{
    tmpFile="/go/src/github.com/go-xorm/cmd/xorm/templates/goxorm"
    toDir="/go/src/srv/spider_kline/model/"
    cd $srcDir
    xorm reverse -s mysql "${dbUser}:${dbPass}@tcp(${dbHost}:3306)/${dbName}?charset=utf8" /go/src/github.com/go-xorm/cmd/xorm/templates/goxorm $toDir
}

buildServer()
{
    if [ $# -eq 0 ]; then
        echo "Please input parameters!"
    else
        while [ "$#" -ge "1" ]; do
            if [ "$1" == "struct" -o "$1" == "structs" ]; then
                rebuildDbStructs
            fi
            shift
        done
    fi
}

buildServer $*

